package com.sun.api;

import com.sun.connection.Connection;
import com.sun.protocol.Protocol;

import java.nio.charset.StandardCharsets;

/**
 * @author 烛龙神
 * @Description api操作层
 * @date 2021-04-07 21:28
 */
public class Jedis {
    private Connection connection;

    public Jedis(String host,int port)
    {
        connection = new Connection(host,port);
    }

    public String set(final String key,final String value)
    {
        connection.sendCommand(Protocol.Command.SET,key.getBytes(),value.getBytes());
        return null;
    }

    public String get(final String key)
    {
        connection.sendCommand(Protocol.Command.GET,key.getBytes());
        return connection.getReply();
    }
}
